package org.dubbo.live.api.sentinel.controller;


import com.alibaba.csp.sentinel.annotation.SentinelResource;
import com.alibaba.csp.sentinel.slots.block.BlockException;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description: //todo
 * @Author: 张广焱
 * @Date: 2024-03-24 12:18
 */
@RestController
public class SentinelDemoController {
    @SentinelResource(value = "confirmOrderDo", blockHandler = "doConfirmBlock")
    @GetMapping("/helloa")
    public String doConfirm(String name) {
        return "hello"+name;
    }
    //BlockException 这俩名称一定要一样 ，接口的资源名称不要和接口路径一致，会导致限流后走不到降级方法中
    public String doConfirmBlock(String name, BlockException blockException) {
        return name+"限流";
    }

}